<template>
  <view class="page-container">
    <view class="tech-card-grid p-16">
      <view
        v-for="tech in techList"
        :key="tech.name"
        class="tech-card flex flex-col flex-x-center flex-y-center p-16"
        :hover-class="'tech-card-hover'"
        @click="navToTechPage(tech.path)"
      >
        <text class="card-title block truncate">{{ tech.name }}</text>
        <text class="card-description block">{{ tech.desc }}</text>
      </view>
    </view>
    <view class="bottom-padding" />
  </view>
</template>

<script>
export default {
  name: 'Examples',
  data() {
    return {
      techList: [
        {
          name: 'SCSS',
          desc: '成熟强大的 CSS 预处理器，\n提供高级功能。',
          path: '/pageExamples/pages/scss/scss',
        },
        {
          name: 'UV-UI',
          desc: '轻量级 UI 组件库，\n提供丰富的组件支持。',
          path: '/pageExamples/pages/uv-ui/uv-ui',
        },
        {
          name: 'Vuex',
          desc: 'Vue 官方状态管理库，\n提供集中式状态管理。',
          path: '/pageExamples/pages/vuex/vuex',
        },
        {
          name: 'Luch-Request',
          desc: '基于 Promise 的请求库，\n提供统一的请求配置和拦截器。',
          path: '/pageExamples/pages/luch-request/luch-request',
        },
        {
          name: 'Lodash-es',
          desc: '模块化实用工具函数，\n按需引入减小体积。',
          path: '/pageExamples/pages/lodash-es/lodash-es',
        },
        {
          name: 'Day.js',
          desc: '轻量级日期处理库，\n提供丰富的日期操作功能。',
          path: '/pageExamples/pages/dayjs/dayjs',
        },
      ],
    }
  },
  methods: {
    navToTechPage(path) {
      uni.navigateTo({
        url: path,
      })
    },
  },
}
</script>

<style lang="scss">
.page-container {
  position: relative;
  overflow: hidden;
  color: #e5e5e5;
  background-color: #000;

  &::before {
    position: absolute;
    top: -300rpx;
    left: -300rpx;
    z-index: 0;
    width: 1000rpx;
    height: 1000rpx;
    pointer-events: none;
    content: '';
    background: radial-gradient(circle, rgba(0, 220, 255, 0.1) 0%, transparent 70%);
    filter: blur(120rpx);
  }

  &::after {
    position: absolute;
    right: -400rpx;
    bottom: -400rpx;
    z-index: 0;
    width: 1200rpx;
    height: 1200rpx;
    pointer-events: none;
    content: '';
    background: radial-gradient(circle, rgba(255, 42, 109, 0.08) 0%, transparent 70%);
    filter: blur(140rpx);
  }
}

.tech-card-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16rpx;
}

.tech-card {
  aspect-ratio: 1;
  text-align: center;
  background-color: #1f1f1f;
  border: 1rpx solid rgba(255, 255, 255, 0.1);
  border-radius: 16rpx;
  box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease-out;

  &.tech-card-hover {
    background-color: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 5rpx 20rpx rgba(0, 0, 0, 0.4);
    transform: scale(1.05);
  }
}

.card-title {
  width: 100%;
  margin-bottom: 4rpx;
  font-size: 32rpx;
  font-weight: 500;
  color: #fff;
}

.card-description {
  width: 100%;
  font-size: 28rpx;
  line-height: 1.5;
  color: #d1d5db;
}

.bottom-padding {
  height: 16rpx;
}
</style>
